package com.zyp.demo.web;

import com.zyp.demo.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * Created by limi on 2017/10/24.
 */
@Controller
public class AboutShowController {
    @Autowired
    private BlogService blogService;
    @GetMapping("/about")
    public String about(@PageableDefault(size = 3,sort = {"updateTime"},
            direction = Sort.Direction.DESC) Pageable pageable, Model model) {
        model.addAttribute("page",blogService.listBlog(pageable));
        return "about";
    }
}
